<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>图书管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/static/css/public.css" media="all">
    <style>

    </style>
</head>
<body>

<div class="layui-row">
    <div class="layui-col-md6" style="margin-right: 20px">
        <form class="layui-form" action="">


            <div class="layui-form-item">
                <label class="layui-form-label">书名</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                           class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">出版社</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">出版日期</label>
                <div class="layui-input-inline">
                    <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-inline">
                    <select name="quiz1">
                        <option value="">请选择省</option>
                        <option value="浙江" selected="">浙江省</option>
                        <option value="你的工号">江西省</option>
                        <option value="你最喜欢的老师">福建省</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="quiz2">
                        <option value="">请选择市</option>
                        <option value="杭州">杭州</option>
                        <option value="宁波" disabled="">宁波</option>
                        <option value="温州">温州</option>
                        <option value="温州">台州</option>
                        <option value="温州">绍兴</option>
                    </select>
                </div>

            </div>

            <div class="layui-form-item">
                <!--隐藏域存储图片路径 imgPath-->
                <input type="hidden" name="imgPath" required id="imgPath">
                <label class="layui-form-label " required>图片上传</label>

                <!--id 绑定上传操作id-->
                <div class="layui-upload-drag" id="uploadImgFile">
                    <i class="layui-icon"></i>
                    <p>点击上传，或将文件拖拽到此处</p>
                    <div style="width: 196px;">
                        <div class="layui-progress layui-progress-big" lay-showpercent="yes" lay-filter="filterImg">
                            <div class="layui-progress-bar" lay-percent=""></div>
                        </div>
                    </div>
                </div>
                <img id="strImg" src="" alt="上传成功后渲染" style="max-width: 196px; visibility: hidden">
            </div>


            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">简介</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                    <a href="/books.html" class="layui-btn">返回</a>
                </div>
            </div>
        </form>
    </div>
    <div class="layui-col-md5">
        <form class="layui-form" action="">

            <!--            选择作者-->
            <div class="layui-form-item">
                <label class="layui-form-label">作者</label>
                <div class="layui-input-block">
                    <select name="interest" lay-filter="aihao">
                        <option value="">如果已有作者,可直接选择</option>
                        <option value="0">写作</option>
                        <option value="1">阅读</option>
                        <option value="2">游戏</option>
                        <option value="3">音乐</option>
                        <option value="4">旅行</option>
                    </select>
                </div>
            </div>
            <!--            选择作者-->

            <!--            或添加作者-->
            <div class="layui-form-item">
                <label class="layui-form-label">作者名称</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">作者简介</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>

            <!--            或添加作者-->

            <!--            位置信息-->
            <div class="layui-form-item" id="place-btn">
                <label class="layui-form-label">书籍位置</label>
                <div class="layui-input-block">
                    <input type="text" style="width: 70%;display: inline-block;margin-right: 10px" name="title"
                           lay-verify="title" autocomplete="off"
                           placeholder="6::46::A::3(6楼46行A面3架)"
                           class="layui-input">
                    <button type="button" class="layui-btn" onclick="addInput()"><i class="layui-icon"></i></button>
                </div>
            </div>
            <!--            位置信息-->


        </form>
    </div>
</div>


<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    let $$ = null
    layui.use('table', function () {
        let table = layui.table,
            $ = $$ = $$ = layui.jquery,
            upload = layui.upload
        laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });

        //拖拽上传
        upload.render({
            elem: '#uploadImgFile',
            url: "uploadFilesImgCloud",
            accept: "image",
            acceptMime: "image/*,image/webp,image/jfif",
            auto: true,
            choose: function (obj) {

            },
            before: function (res) {

            },
            done: function (res) {

            },
            progress: function (n, elem, e) {

            },
            error() {

            },
        });

    });

    function addInput() {
        let html = `
            <div class="layui-form-item">
                <label class="layui-form-label">书籍位置</label>
                <div class="layui-input-block">
                    <input type="text" style="width: 70%;display: inline-block;margin-right: 10px" name="title"
                           lay-verify="title" autocomplete="off"
                           placeholder="6::46::A::3(6楼46行A面3架)"
                           class="layui-input">
                    <button type="button" class="layui-btn" onclick="addInput()"><i class="layui-icon"></i></button>
                </div>
            </div>
        `

        $$('#place-btn').after($$(html))

    }

</script>
</body>
</html>
